home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk8 / a68k121 / asm68k.doc next >
Text File  |  1995-03-18  |  63KB  |  1,273 lines

  1.                               Page 1
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.                                 wAsm68kw
  11.  
  12.                             68010 Macro Assembler
  13.                                 Version 1.2.1
  14.                                     Docs
  15.  
  16.                               Date:  03-Jul-87
  17.  
  18.  
  19.  
  20.                                   NOTICE:
  21.  
  22.    THIS FILE AND THE PROGRAM IT DESCRIBES ARE COPYRIGHT © 1987, W. WESLEY
  23. HOWE. ALL RIGHTS RESERVED. A LIMITED LICENSE FOR USE AND DISTRIBUTION WITH-
  24. OUT PROFIT IS GRANTED TO POSSESSOR OF THIS FILE. NO RIGHT OF ALTERATION OF
  25. THE PROGRAM OR DOCUMENTATION IS CONVEYED WITH THIS LIMITED LICENSE.
  26.    NO WARRANTY IS EXPRESSED OR IMPLIED HEREIN ON THE SUITABILITY OF THIS
  27. PROGRAM FOR ANY PURPOSE WHATSOEVER. YOU MUST RELY ON YOUR OWN JUDGEMENT AS
  28. TO WHETHER THIS PROGRAM WILL OPERATE PROPERLY WITH YOUR COMPUTER FOR WHAT-
  29. EVER PURPOSE YOU MAY DESIRE TO USE IT FOR.
  30.  
  31.  
  32.  
  33.  
  34.  
  35.                 ADDRESS ALL QUESTIONS, COMMENTS OR CRITICISM TO:
  36.  
  37.                                   WESLEY HOWE
  38.                                4800 LAKEMONT DR.
  39.                               RALEIGH,  NC  27609
  40.  
  41.                               Page 2
  42.  
  43.  
  44.                              LIMITS:
  45.  
  46.         Source-line length:         255 bytes (including newline)
  47.         Sub-expression length:       40 bytes
  48.         Parenthesis nesting:         16 levels
  49.         Symbol length:               31 bytes
  50.         Macro Size:               8,190 bytes
  51.         Number of Macros:               Available RAM
  52.         Number of Symbols:              Available RAM
  53.         Available RAM:        1,056,768 bytes maximum heap utilized
  54.         Macro Nesting:                8 levels
  55.         Include Nesting:              8 levels
  56.         Conditional Nesting:         16 levels
  57.         Macro Parameters:            10 per invocation
  58.         Sections:                   255 maximum
  59.         Minimum RAM necessary:  128,000 bytes
  60.         Constant size:              255 bytes
  61.         Storage size:            65,535 bytes
  62.         Strings:                    255 bytes (or line length limit)
  63.         Minimum stack:            8,192 (recommended)
  64.         Operating System:               AmigaDOS 1.2 (CLI Only)
  65.  
  66. ==============================================================================
  67.  
  68.    If you are an experienced 68000/68010 Assembly language programmer, you
  69. will find much of this material useful in understanding assembly language
  70. programming on the AMIGA. If you are an experienced AMIGA assembly language
  71. programmer, you may find much of the material boring, and will only want to
  72. use this as a reference document. If you don't know assembly language, then
  73. this document will not teach it, so you may need to get one of a number
  74. available reference books on MC68000 assembly language programming.
  75.    In the following sections, Directives, Commands, Expressions and
  76. Mnemonics are referred to. A Directive or Command is an instruction to
  77. the assembler which causes a specific action to be performed. Some of these
  78. add data to the object file, and some only affect the way assembly
  79. operations are performed. A Mnemonic is the Pseudo-English abbreviation for
  80. an instruction the assembler is to translate into the appropriate numeric
  81. sequence and include in the object file for the MC68000 processor
  82. to perform later, when your program is run. An expression refers to any
  83. sequence of items consisting of numbers, symbols with a numerical value, and
  84. the allowable math operators all of which must reduce to a single number
  85. value.
  86.  
  87.  
  88.                               Page 3
  89.  
  90.  
  91.    wInvoking the Assembler:w
  92.  
  93.    The assembler is designed to be run only from the CLI interface. If you
  94. don't know how to find the CLI interface, read the manuals that came with
  95. the machine before trying to use this program.
  96.    The minimum invocation must be the program name Asm68k followed with a
  97. source filename (separated by at least one space from the program name.)
  98. This will yield an assembly, with an object file output in the AMIGA format,
  99. and a listing file. The filenames for these files will be created by
  100. stripping any extension (period followed by characters) from the source
  101. filename and appending .o for the object filename and .lst for the listing
  102. filename. Any error messages will list to the screen.
  103.  
  104.    Example:
  105.  
  106.                 Asm68k MyProgram.a
  107.  
  108.    Outputs:
  109.  
  110.                 MyProgram.o     (The relocatable binary object file)
  111.                 MyProgram.lst   (A combined source and hex object file)
  112.  
  113.    If this isn't what you want, a wide variety of "switches" are supported
  114. to control the usage of the assembler, and the descriptions follow:
  115.    (A switch is a parameter you type after the program name and source
  116. filename, with an intervening space. These switches all start with the
  117. minus sign '-' and may be followed immediately by a letter or letters as
  118. shown below.)
  119.  
  120.    -C   This switch has been included for compatability. It should be
  121. followed with only the following characters, as many as wanted, with no
  122. spaces:
  123.         S   Generates a symbol table at the end of the list file (the
  124.             default.)
  125.         D   Does nothing.
  126.         C   Causes Case of all Labels and symbols to be ignored. With this
  127.             switch activated, LABEL, Label and label will all be interpreted
  128.             as the same name. This is not the default.
  129.         X   Does nothing.                                                
  130.    -E   Causes ERROR messages to list to the named file. It may be followed
  131. immediately with a filename containing no spaces, or type a space and then
  132. enclose the filename in double quotes if it contains spaces. You may also
  133. use the intervening space without quotes on a filename without spaces if you
  134. like. A given object filename will be used instead of the default filename
  135. normally used.                                                           
  136.    -H   HEADER file. Causes a search for the filename given after the switch
  137. (as above) which will be read as a source file before the source file is
  138. read (but after the initialization file, if enabled.) Just like the
  139. initialization file, if the file is not found, no warning or error is issued
  140. directly. All the source from this file will also be numbered as line 0.
  141.  
  142.  
  143.                              Page 4
  144.  
  145.  
  146.    -I   An INCLUDE directory search path list should follow this switch and 
  147. should contain directory names (no spaces allowed) separated from each other
  148. with plus signs '+', commas or spaces. If spaces are used, then you must
  149. space the list off from the switch and enclose the entire list in double
  150. quotes. Use of this switch will cause the assembler to search for an INCLUDE
  151. file in each of the named directories if it is not found in the current
  152. one.                                                                     
  153.    -L   Causes the LISTING file to be generated (also a default.) The usage
  154. is just like the -O switch.                                             
  155.    -N   This switch turns things off (NO.) Like -C, you should follow it
  156. with a series of letters from the following list, without any spaces:
  157.         S   Turns off the SYMBOL table normally produced at the end of the
  158.             listing file.
  159.         L   Stops the LISTING file from being generated.
  160.         E   Inhibits the ERROR file, if you turned it on.
  161.         V   A synonym for the E switch above.
  162.         P   Inhibits the PAGINATION of the listing file.
  163.         O   Inhibits the OBJECT file generation.
  164.         Q   Inhibits the conversion of mnemonics to QUICK form. The default
  165.             is to convert allowable values of ADD and SUB to the quick form
  166.             if it is safe (values already defined.)
  167.         X   Keeps the assembler from stripping the eXtension from the source
  168.             filename when forming default filenames.
  169.         R   Causes the assembler to generate the object code in a non-
  170.             RELATIVE format. The format used is the Intel format, and the
  171.             program counter is only output to 16-bits of significance. No
  172.             symbol or relocation information is output, and no linker or
  173.             loader is available to operate on this format.               
  174.    -O   Causes the OBJECT file to be generated (this is a default value.)
  175. On this switch, if no filename is given, a default filename will be formed
  176. like the error and listing names, using the extension .o                 
  177.    -R   This is the relax switch. The following parameters should follow the
  178. switch immediately, with no spaces:
  179.         M   Stops the assembler from reporting that less parameters were
  180.             supplied for a macro than were called.
  181.         R   Eliminates messages about relative references to other sections.
  182.             Note that any mnemonic that has a PC-relative mode available
  183.             will still assemble as PC-relative, and will not run on the
  184.             Amiga. Declare all references between sections as ENTRY (XDEF).
  185.             The linker can be used so as not to include resolved references
  186.             in the load file.                                            
  187.    -V   VERIFICATION file. Another name for the -E switch.
  188.                                                                           
  189.    -X   This switch should be followed immediately with up to 6 characters,
  190. and will cause the default object filename to be formed by stripping the
  191. extension and appending a period and the characters following the X.     
  192.    >   The right bracket, followed immediately with a filename, will cause
  193.  the signon, progress and all error messages to be diverted by AmigaDOS to
  194. the named file when it is the first parameter after the program name. If
  195. it is not the first, the assembler will send the error messages to the
  196. named file.
  197.  
  198.  
  199.                              Page 5
  200.  
  201.  
  202.  
  203.    All the preceding switches may be used in either UPPER or lower case, and
  204. will generate the same results. The source filename should be the first
  205. parameter after the program name, but only to avoid confusion. It must be
  206. the only parameter not associated with a switch, and may not be given twice.
  207. The source filename is the only mandantory command-line parameter.
  208.  
  209.  
  210.                              Page 6
  211.  
  212.  
  213.                           Math & Logic Operators:
  214.  
  215.          +      Addition                 -      Subtraction or Negation
  216.          ~      NOT                     <<      Left shift
  217.         >>      Right shift              &      AND
  218.          |      OR                       !      OR  (for compatability)
  219.          ^      XOR (Exclusive OR)       /      Integer Division
  220.         %%      Integer Modulo           *      Integer Multiplication or
  221.                                                 Program Counter Location
  222.  
  223.    All expressions evaluate in strict Left-to-Right order, as divided by
  224. parentheses. Symbols and constants may be mixed, and space or tab characters
  225. may be included. No individual portion of the expression may exceed 40
  226. characters (NOTE: a 'portion' would be any symbol or number alone.)
  227.  
  228. Some examples:
  229.         4+(7*2)         Yields  18      4 + ( 7 * 2 )   Yields  18
  230.         4+7*2           Yields  22      -4*6            Yields -24
  231.         6*-4            Yields -24      4(6*7)          Error
  232.         ('A'+1)         Yields  66      "A" + 1         Yields 194
  233.         'ASDF'+0        Yields  1,095,976,006
  234.  
  235. Program Counter: The symbol * can be used as shorthand for the current
  236. PC (relative offset) under the following criteria if it occupies the
  237. position in an expression normally occupied by a value.
  238.  
  239.  
  240.                              Page 7
  241.  
  242.  
  243.  
  244.  
  245.                            Numbers and Constants:
  246.  
  247.    Binary:   A binary number is either [1] prefixed with the '%' (percent)
  248. character, or [2] followed immediately with the letter 'B' (UPPER or lower
  249. case). It may contain only the digits '1' or '0'.
  250.  
  251.    Octal:   An octal number is either [1] prefixed with the '@' (at)
  252. character, or [2] followed immediately with either the letter 'O' or the
  253. letter 'Q', in either case. Only the digits '0' through '7' are valid.
  254.  
  255.    Decimal:   A decimal number contains only the digits '0' through '9', and
  256. may be optionally followed immediately with the letter 'D' (either case.)
  257.  
  258.    Hexa-Decimal:   HexaDecimal numbers contain the digits '0' through '9',
  259. and the letters 'A' through 'F' (in either UPPER or lower case.) They may be
  260. [1] prefixed with the '$' (Dollar) character, or [2] they must start with a
  261. digit and be followed immediately with either the letter 'H' or the letter
  262. 'X', in either UPPER or lower case. A leading '0' may be prefixed for the
  263. post-fix form.
  264.  
  265.    Leading zeros do not affect the value of any of the number forms,
  266. although the 40 character limit applies to them also.
  267.  
  268.    Characters:   Multiple ascii character may be included by enclosing them
  269. in QUOTES. The single quote will yield an ascii value, and the double
  270. quote will yield an ascii value with bit 7 SET (or'd with 128). Multiple
  271. byte constants are evaluated by successive left-shifts. Only the last 4
  272. characters are retained as a 32-bit value.
  273.  
  274. Some Examples:  The number 1,000 (one thousand) may be represented
  275.                 any one of the following ways:
  276.  
  277.                 1111101000B     01111101000b    %1111101000
  278.                 1750Q           01750o          @1750
  279.                 1000D           0001000d        1000
  280.                 3e8H            03E8h           $3e8
  281.                 'E0'-'AH'
  282.  
  283.  
  284.                              Page 8
  285.  
  286.  
  287.  
  288.  
  289.  
  290.                           Assembly Line Format:
  291.  
  292.  
  293.  
  294.    An input assembly line follows the following models:
  295.  
  296.  
  297. Label1          Mnemonic        Operand , MoreOperands ;comment
  298.  Label2:        Mnemonic        Operand
  299.                 Mnemonic        Operand
  300. Label3:         Mnemonic
  301. LabelOnly
  302. *                                       a comment only
  303.         ;                               another comment
  304.  
  305.  
  306.    Note that the LABEL either starts in the first column, or is followed by
  307. a colon. The Mnemonic field is separated by at least one space or tab, and
  308. never starts in the first column. Operands, where needed, follow, separated
  309. from the Mnemonic by at least one space or tab. Multiple operands are
  310. separated from each other by a comma (the comma flags the assembler that
  311. there is another operand available.) An asterisk in the first position on
  312. the line indicates a comment only line, or comments may follow complete
  313. operands with a semicolon separator. Assembler directives occupy the
  314. Mnemonic position, and comments are optional. Labels are allowed on all
  315. lines, and are required for some assembler directives.
  316.  
  317.  
  318.                              Page 9
  319.  
  320.  
  321.                             Constants:
  322.  
  323.    The following Assembler directives cause the inclusion of data in the
  324. Object file:
  325.  
  326.    DB   Yields 8-bit values. Either STRINGS, Symbols, Labels, numbers or
  327. expressions may be evaluated. Multiple operands need to be separated by
  328. commas, and generate successive bytes up to a limit of 255 bytes (the line-
  329. length limit should prevent this from ever being reached.)
  330.  
  331.    DW   Yields 16-bit values, in Hi-Lo order. The format is the same as the
  332. DB directive, except STRINGS will not be evaluated. If the address is not a
  333. word address, a pad byte will be appended to the previous line, and a non-
  334. fatal error message will be issued.
  335.  
  336.    DL   Yields 32-Bit values. Otherwise equivalent to DW.
  337.  
  338.    DC   This directive is the same as DW. Appending .L or .B (in either
  339. case) will change the function to be the same as DL or DB, respectively.
  340. (DC.W is legal.)
  341.  
  342.    ASCII   This command yields a sequence of bytes equivalent to the ascii
  343. value of the operands (delimited by quotes) provided. Single quotes will
  344. yield the normal value, and double quotes will yield values with bit 7 SET.
  345. Within the delimited STRING, a '\' (backslash) character, followed by up to
  346. three decimal digits will cause inclusion of a byte with the same numerical
  347. value, or if followed by any other character will allow the inclusion of
  348. that character immediately following. (This is useful for including quotes
  349. and backslashes in the string.) Quotes may also be included by following the
  350. convention of using two quotes in succession.A limit of 255 values applies.
  351.  
  352.    CSTRING   This command is the same as ASCII, except an additional byte
  353. with the value 0 is appended (as in the C language.)
  354.  
  355.    PSTRING   This is the same as ASCII also, except a leading byte with a
  356. value equal to the number of bytes following is prepended (as used in the
  357. PASCAL language).
  358.  
  359.    ISTRING   This variant of ASCII will cause the final character to have
  360.  its most significant bit of the opposite (INVERTED) value from the rest of
  361. the characters in the string (as defined by the delimiting quotes). This
  362. form is popular among 8-bit machines, and some BASIC interpreters. It's
  363. usefulness with the new international 8-bit standard ASCII is questionable,
  364. but it may be helpful, so it has been included anyway.
  365.  
  366.    DCB   This command accepts the .B .W and .L size specifiers (or defaults
  367. to WORD.) It generates as many values as the operand expression evaluates
  368. to (up to 255 bytes total), of the size specified. WORD and LONG sizes
  369. are forced to an even address alignment.
  370.  
  371.  
  372.                              Page 10
  373.  
  374.  
  375.  
  376.                            Symbol and Labels:
  377.  
  378.    A Label is an address designator. It is placed before a mnemonic or a
  379. data location, and acquires a value equal to the relative program counter
  380. value at that location. A standard Label may only be defined this way once
  381. in a program, but may be referenced as many times as needed. It must start
  382. with a letter, a period or the '_' (underscore) character, and may contain
  383. only these characters, or the digits '0' through '9', without spaces up to
  384. a total of 31 characters. When you define a label, it must appear as the
  385. very first item on a line, or you must append a ':' (colon) character to it.
  386. (You may have the colon in the first case also.) You must not use the colon
  387. on the label other than when you define it, or you may get an erroneous
  388. interpretation of your expression.
  389.    A Symbol starts off looking like a label, and follows the same rules,
  390. except the following commands modify it to acquire a new type and value:
  391.  
  392.    EQUATE   Sets a permanent, absolute value equal to the value of the
  393. expression following this directive. STRING values are not allowed.
  394.  
  395.    SETVAL   Sets an absolute value which is retained until a new value is
  396. set. You may not later use EQUATE on this label, but you can EQUATE a
  397. different label to the set value.
  398.  
  399.    EQUR   Gives a value to the symbol which may later be used in place of a
  400. standard data or address register. This is valid only for D0-D7 or A0-A7 (SP
  401. is a synonym for A7). You cannot use this value other than to reference a
  402. register in a MC68010 mnemonic.
  403.  
  404.    REG   Accepts a register-list operand for use with the MOVEM mnemonic. A
  405. register-list looks like this:
  406.  
  407.                         A2-A7/D1/D3-D7
  408.  
  409. Which defines the registers A2 through A7, D1 and D3 through D7. In fact,
  410. all the registers except A0, A1, D0 and D2. Only the standard address and
  411. data registers may be defined in this fashion.
  412.  
  413.    MACRO   Assigns a sequence of input lines, with replacable parameters,
  414. which will later be substituted for any line which uses this symbol as a
  415. mnemonic or command. More on Macros later.
  416.  
  417.    These Directives must have a Label in the Label Field for assignment,
  418. except for MACRO, which may have  its name in the operand slot.
  419.  
  420.  
  421.                              Page 11
  422.  
  423.  
  424.    You must avoid referencing a symbol before giving it a value, or the 
  425. assembler will complain (sometimes), because the forward reference will make
  426. it type the symbol as a label, which is an address, not a number. Labels, of
  427. course, may be referenced before use, and  its value will be substituted on
  428. the second pass. In fact, this is the only reason you need a two-pass
  429. assembler.
  430.  
  431.  
  432.                            Local (Numeric) Labels:
  433.  
  434.    A line may be labeled with a special Local Label which attaches itself to
  435. a specific offset from the last proper line label, as previously described.
  436. A Local Label is a sequence of up to three decimal digits followed by the
  437. '$' (Dollar) character. Like a regular Label, if it does not start at the
  438. beginning of the line, it must be followed by a colon.
  439.    A Local Label may be referenced in an operand anywhere a line Label
  440. would, but  its scope is only between one regular Label and the next. Each
  441. time a new regular Label is used, the Local Label may then be redefined and
  442. reused with a different value.
  443.  
  444.    An example:
  445.  
  446. Start   Jsr     Initialize_Data
  447. 001$    Jsr     Initialize_Serial
  448.         Move.b  D1,ChangeFlag
  449.         Cmp.b   #0ffh,D1
  450.         Bne     1$
  451.  
  452.    Note that 001$ and 1$ will evaluate to the same location. You need not
  453. start with one and may use any numbers you desire, as long as their value
  454. does not exceed 999. Also, note that $1 and 1$ are interpreted differently;
  455. the first is an absolute expression, and the second is a relative address.
  456. Local Labels may not be used for Macro names, although they may be used
  457. within Macros, and cannot be used to represent Numbers, EXTERNal or ENTRY
  458. types.
  459.  
  460.  
  461.                              Page 12
  462.  
  463.  
  464.                          Conditional Assembly Directives:
  465.  
  466.    The following Commands allow assembly to proceed until a matching ENDIF
  467. Directive is found, or disable assembly until the ENDIF is reached if the
  468. condition is not met:
  469.  
  470.         IFEQ    Expression EQuals zero. (e.g. 4-4)
  471.         IFGE    Expression Greater than or Equal to zero. (e.g. 4-4 or 4-3)
  472.         IFGT    Expression Greater Than zero. (e.g. 4-3)
  473.         IFLE    Expression Less than or Equal to zero. (e.g. 4-4 or 4-5)
  474.         IFLT    Expression Less Than zero. (e.g. 4-5)
  475.         IFNE    Expression is Not Equal to zero. (e.g. 4-5 or 4-3)
  476.  
  477.    The above conditionals are evaluated to 32 bits, but the condition
  478. decision is based on their WORD (16-bit) value.
  479.  
  480.         IFD     Label following was already Defined (not just referenced.)
  481.         IFND    Label following has Not yet been Defined.
  482.         IFC     Both STRINGS following Compare (same length and characters.)
  483.         IFNC    Both STRINGS do Not Compare (different length or
  484.                            characters.)
  485.  
  486.    The last two conditional commands need two operands, separated by a
  487. comma. They may be delimited with Quotes (single or double), or by a left
  488. bracket '<' and right bracket '>' pair, or the first string will start at
  489. the first character which is not a space or a tab, and end at the first
  490. occurrence of a comma or space or tab, and the second will start at the
  491. next character which is not a comma or a space or a tab and will end at
  492. the first space, tab, semicolon or newline character. To enclose spaces in
  493. the string, you must use either the quote or bracket delimiters. To enclose
  494. quotes, use the brackets, and to enclose brackets, use the quotes. Both
  495. quotes and brackets cannot be passed together unless you use the spaces,
  496. but then you can't have spaces in the string. Just shows to go you,
  497. everything is a compromise. Any backslash character sequences are not
  498. expanded before comparison (except inside Macros.)
  499.    Each Conditional command DO level ends with an ENDIF command. DO levels
  500. nest only to 16 levels, or a fatal error will be generated (whether the
  501. assembly is on or off, each IFxx increases the level count, and each ENDIF
  502. decreases the count; exceeding 16 or going below zero are fatal errors.) DO
  503. levels are not active during a macro definition, but will be evaluated
  504. during a macro expansion.
  505.  
  506.  
  507.                              Page 13
  508.  
  509.  
  510.  
  511.                        Other Assembler Directives:
  512.  
  513.  
  514.    RESERVE   Creates an uninitialized data storage area, with a size equal
  515. to the expression following it. The size designators .B .W and .L (any
  516. case) may be used, or WORD is assumed. The expression following the
  517. Directive is expanded to the size specifier. This is the only Directive
  518. which is not limited in size to 255 bytes for the result, but may yield up
  519. to 65,535 bytes.
  520.  
  521.    ENDSRC   Shuts off assembly for the current DO level. (See the section on
  522. conditional assembly for DO level explanation.) If you are not in a DO
  523. level, the source is read to the end of file, but no assembly action will
  524. occur.
  525.  
  526.    OPTION   This command accepts the following operands only:
  527.  
  528.             M - Allows macro call lines to print in the assembly listing.
  529.                 (If List is on.) This is the default condition.
  530.            NM - Hides macro call lines, showing expansion lines only.
  531.             L - Turns on listing. (The default condition).
  532.            NL - Shuts off Listing.
  533.  
  534. (Neither of these commands override the command-line switches directly, they
  535. only control the flow of data. An assembly will still create a list file if
  536. not prohibited, Option NL will just make it an empty file. If the list file
  537. was disabled on the command line, Option L will not send the listing
  538. anywhere. None of the operands are case-sensitive.)
  539.  
  540.    TITLE   Accepts a STRING (delimited by quotes) which will label all
  541. pages, if paging is not disabled. The Maximum title length is 40 characters.
  542. Also cause pages to be numbered.
  543.  
  544.    ORIGIN   Sets the program counter to the value of the expression
  545. following the command. Origin remains relative on AMIGA output format.
  546.  
  547.    PAGEUP   Causes a page to end if paging is not disabled. A form-feed
  548. character is sent, and a page heading with the optional title (see TITLE) is
  549. printed.
  550.  
  551.  
  552.                              Page 14
  553.  
  554.    SECTION   This command causes a new section, or Hunk, to be created in
  555. the AMIGA output format. The first operand must be a name containing no
  556. spaces and having less than 40 total characters. The second operand, if
  557. given, should be separated by a comma and should be either CODE, TEXT, DATA
  558. or BSS. If none is given, CODE is assumed. (only the first character is
  559. checked, however, so DUMMY will yield a DATA section definition.) TEXT is
  560. equivalent to CODE. Case is not significant on the section type, but case
  561. is important for the name. Optionally, the type may be followed by a
  562. comma and either PUBLIC, FAST or CHIP to specify the memory type in which
  563. the hunk is to load. If the operand isn't present, PUBLIC (any) is the de-
  564. fault. If the section name has been used before, assembly will proceed at
  565. the next location as was previously defined, and the resultant code, data
  566. or storage space will be coalesced into one Hunk. AmigaDOS loads different
  567. hunks into different memory locations, so all references to data between
  568. sections should be to Labels declared as ENTRY (XDEF) to ensure assembly
  569. as absolute locations. A warning is issued (unless shut off, see the
  570. switches section) when this condition is detected. See the AmigaDOS manual
  571. for more information on Hunks.
  572.  
  573.    IDENTIFY   This command should be followed with a name, which will be
  574. given to the program unit (a program unit is a hunk or a collection of
  575. hunks to be fed to the linker.) Only the first name given will be used,
  576. subsequent uses are ignored. If the IDENTIFY command is not used during an
  577. assembly, the object file will be given a name that has 0 characters in
  578. it. (Null string.)
  579.  
  580.    EXTERN   Followed by one or more Labels or symbols (separated by commas.)
  581. These labels must not be defined within the  entire assembly source, and
  582. cause the assembler to generate the appropriate external reference
  583. instructions in the object file (AMIGA format only) for resolution by the
  584. linker. Multiple EXTERN usage on the same Symbol name is ignored.
  585.  
  586.    ENTRY   Followed by one or more Labels or Symbols. These labels, which
  587. need to be defined somewhere, allow locations within the program unit to be
  588. visible to the linker to resolve other program unit EXTERNal references. A
  589. program that consists of more than one object file will need to have an
  590. ENTRY in one unit for every EXTERN in the other units, or the program will
  591. 'BOMB' and probably either lock-up the machine or cause the dreaded GURU to
  592. appear. References between different sections must be to ENTRY labels, since
  593. the AMIGA loader will place each section wherever it will fit, and resolve
  594. all these different addresses. If you never use the section command, the
  595. entire program will have to fit in the same place, and might not be able
  596. to be loaded if there is not a spot big enough for the whole thing
  597. (depending on how many tasks might also be running, etc.) As for EXTERN,
  598. duplicate references to the same name cause the second reference to be
  599. ignored.
  600.  
  601.  
  602.                              Page 15
  603.  
  604.  
  605.    EXECUTE   This command will pass the quote delimited string following it
  606. to AmigaDOS during the second pass. The current window is the input and
  607. output. A more detailed description of the Execute routine is located in
  608. the AmigaDOS manual, but basically the same things you can do from the CLI
  609. may be contained within the string and executed from within the assembler.
  610. The Source, Object and any open Include files will be locked, and cannot
  611. be accessed at this time. No use is made of the return value from the
  612. program called.
  613.  
  614.    CNOP   This Directive causes null filler bytes to be inserted into the
  615. object file until the desired alignment is reached. There may be one or two
  616. values after the Directive, separated a comma. The second value given, or
  617. the single value is the desired alignment value you want, and the first
  618. value when two values are given is how many more bytes to add beyond this
  619. point. There may not be more than 255 bytes generated in total to acheive
  620. the desired alignment, and no restrictions are imposed on what alignment
  621. values can be used, but values that are not powers of two will normally
  622. not generate a correct alignment. If you want to set the Program Counter 2
  623. bytes beyond the next PC location evenly divisible by 8 use the command
  624. like this:
  625.  
  626.                         CNOP   2,8
  627.  
  628. The predominant reason for using this command would be to align data at
  629. specific offsets, and to create data structures in specific formats.
  630.  
  631.  
  632.                              Page 16
  633.  
  634.  
  635.  
  636.                             Include Files:
  637.  
  638.    Up to 8 levels of include files may be inserted into the assembly with
  639. the INCLUDE Directive. The syntax demands a Filename or Path, delimited by
  640. quotes. Include file directory searches are supported by command-line
  641. parameters (Detailed in another section.) Include files may be called by
  642. Macros, and Macros may be used by Include files, up to their respective
  643. nesting levels (8 each.) The INCLUDE directive will cause the next source
  644. line to be read from the named file as if the entire contents appeared in
  645. the original source file, except line numbering will start at one again,
  646. and the line number will be followed by a '+' (plus) sign. When the end of
  647. the Include file is reached, the line number will revert to the one
  648. following the line which invoked the INCLUDE Command.
  649.    Special provisions have been made to allow automatic and command-line
  650. inclusion of header and/or macro definition files before assembly starts,
  651. and these files do not count in the nesting level limits for Include
  652. files. A later section will describe command-line parameters and the
  653. configuration file.
  654.  
  655.                           A SPECIAL NOTE:
  656.  
  657. Several of the existing include files from Commodore do not assemble
  658. correctly (particularly those in the exec directory.) Many of the source
  659. lines in these files contain comments which are delimited only by spaces
  660. and an asterisk. Asm68k is not restrictive about spaces within an
  661. expression, and tries to assemble the asterisk as a multiplication operator
  662. with the words in the comment being looked at as labels, and gives
  663. appropriate error messages. Make sure the comments are stripped or
  664. delimited by a semi-colon. A few of the files contain Macro error checks
  665. using an IFC \1,'' which will not assemble correctly with Asm68k. Use IFEQ
  666. NARG instead. Lists.i contains a parenthesized expression as an offset for
  667. an address register. Asm68k will not accept parentheses within 68010
  668. mnemonics except when they are immediate type, as the parentheses denote a
  669. register designation. These changes will make both assemblers happy, and
  670. the include files more portable between applications.
  671.  
  672.  
  673.                              Page 17
  674.  
  675.  
  676.  
  677.  
  678.                                Macros:
  679.  
  680.    The best feature of the assembler, and the hardest one to master, is the
  681. use of the MACRO command. A Macro is simply a sequence of source lines which
  682. may be saved and inserted as often as wanted just by using the name you gave
  683. it as a command. A Macro may contain any of the other Directives and
  684. Mnemonics the assembler recognizes except another MACRO definition command,
  685. although you may use the name of a defined Macro in your Macro (up to 8
  686. levels deep.)
  687.    A Macro is defined (and it must be before being used) by placing the
  688. MACRO in the Mnemonic Field, either before or after  its name. The name for
  689. the Macro must follow the rules for Labels if it is on the left side, or if
  690. it is on the right side it needs to be separated by at least one space or
  691. tab from the MACRO Directive, and follow all the Label rules except it does
  692. not need to be followed by a colon. All the subsequent lines up to the one
  693. which contains the ENDMAC command will be saved for subsequent use.
  694.    The real power of Macros comes from their use with replacable parameters.
  695. When you issue a Macro name as a Command, up to ten parameters (numbered
  696. from one to nine, with zero for ten) may be included in a comma, space or
  697. bracket separated list after the name for use within the Macro text. To make
  698. these parameters appear in the Macro expansion, place a '\' (backslash)
  699. character followed immediately (no spaces) with the digit of the parameter
  700. you want in the definition. When the macro is expanded, the text will
  701. include the parameter placed on the calling line, and will be evaluated just
  702. as if the source had included it as it appears. Parameters are gathered and
  703. passed as they appear, quotes and all.
  704.    The backslash character may be passed to the Macro by including two
  705. backslashes in the calling line, and any non-numeric character following
  706. a backslash other than a backslash will pass both the backslash and the
  707. character following it to the Macro. To pass numeric sequences for use
  708. in a string (such as with the ASCII directive), use two backslashes [as
  709. in \\13, to put the sequence \13 , which puts a carriage return with the
  710. quoted string].
  711.    Conditional Directives are effective within the Macro, under the same
  712. rules as they follow elsewhere. If assembly is enabled, and the Directive
  713. MEXIT is encountered, expansion of the Macro is suspended, and the next
  714. source line will be the one following the Macro invocation line, after the
  715. assembler has examined the remaining Macro text and resolved all the IFxx
  716. and ENDIF levels.
  717.    To make Macros respond differently with different numbers of passed para-
  718. meters, the special symbol NARG (not case-sensitive) has been reserved. It
  719. will yield a value equal to the number of parameters found on the invocation
  720. line within a Macro expansion, and zero elsewhere.
  721.  
  722.  
  723.                              Page 18
  724.  
  725.  
  726.  
  727.    One additional feature within Macros is the \@ (backslash followed by the
  728. at character). While the Macro is being expanded, this combination is
  729. changed to a period followed by three decimal digits. These digits
  730. increment starting from zero every time a macro call is made that uses the
  731. \@ combination, and will be used for the duration of that macro (a
  732. contained macro call will use a new number, then when it ends the former
  733. macro's number will be used until it ends. This allows unique symbol names
  734. to be generated within the Macro text, allowing branch instructions to
  735. occur. Local (numeric) Labels are effective within the Macro, but they do
  736. not attach to the Macro name, nor are they canceled by the Macro invocation
  737. (unless the invocation line was labeled.) 
  738.  
  739.  
  740.                              Page 19
  741.  
  742.  
  743.  
  744.                        Do Nothing Directives:
  745.  
  746.    The following directives are accepted by the assembler, but cause no
  747. action and generate no code, just as if they were comments. They have been
  748. included to allow use of source code written for other assemblers.
  749.  
  750.         MASK2           FORMAT       SPC
  751.         NOL             OFFSET
  752.  
  753.  
  754.                       Synonym Directives:
  755.  
  756.    The directives in the left column are substitute names for the directives
  757. in the right column, and were included for source compatability:
  758.  
  759.                 DS              RESERVE
  760.                 END             ENDSRC
  761.                 EQU             EQUATE
  762.                 SET             SETVAL
  763.                 TTL             TITLE
  764.                 ENDC            ENDIF
  765.                 ENDM            ENDMAC
  766.                 RORG            ORIGIN
  767.                 XREF            EXTERN
  768.                 XDEF            ENTRY
  769.                 RORIGIN         ORIGIN
  770.  
  771. ===============================================================================
  772.                         Unimplemented Directives:
  773.  
  774.    The following Directives, found in some other assemblers, have not been
  775. implemented in this version:
  776.  
  777.         IDNT            FAIL            LIST
  778.         LLEN            PAGE            PLEN
  779.         NOOBJ           NOLIST          NOPAGE      INCDIR
  780.    A startup Macro file has been included with this package to allow some
  781. compatability if these are needed.
  782.  
  783.  
  784.                              Page 20
  785.  
  786.                             Startup Configuration:
  787.  
  788.    If a file named Asm68k.cnf (or a filename the same as the assembler with
  789. the extension .cnf) is found in the same directory spec the assembler was
  790. called from, it is read and acted on. The current version looks for 3 items
  791. in this file, the pagelength (which must be greater than 11), the name (and
  792. path) of the startup file and the assembler startup defaults. The format is:
  793.  
  794.   Page Length:                     1 byte (11-255), binary   =     66
  795.   File Path:                       up to 31 bytes, ascii     =  Asm68k.mac
  796.   Name Terminator:                 1 byte, binary, value 0   =  MANDANTORY
  797.   Output Object File:              1 byte, boolean, Y or N   =     Y
  798.   Output Listing File:             1 byte, boolean, Y or N   =     Y
  799.   Output Error File:               1 byte, boolean, Y or N   =     N
  800.   Object as Intel Format:          1 byte, boolean, Y or N   =     N
  801.   Quick Conversion allowed:        1 byte, boolean, Y or N   =     Y
  802.   Symbol Table Output On:          1 byte, boolean, Y or N   =     Y
  803.   List Paging Enabled:             1 byte, boolean, Y or N   =     Y
  804.   Relax Relative Error check:      1 byte, boolean, Y or N   =     N
  805.   Relax Macro Parameter count:     1 byte, boolean, Y or N   =     N
  806.   Remove extension from source:    1 byte, boolean, Y or N   =     Y
  807.   Show Macro call lines:           1 byte, boolean, Y or N   =     Y
  808.  
  809.    Any characters after these are ignored. When assembly begins, if this
  810. file is found, it is read and assembled as if it was the beginning of the
  811. Source file. All lines from this file are numbered 0, and no warning occurs
  812. if the file is not found (unless you were depending on the definitions in
  813. your program, then you would have lots of error messages.)
  814.    Beware when making this file that the null character MUST be at the end
  815. of the pathname. You can create a file from the keyboard using the command:
  816.  
  817.               COPY con: to Asm68k.cnf
  818.  
  819. then typing a character for the pagelength (B is 66, the default), followed
  820. with the pathname for the startup file, followed with control@ (CTRL key
  821. and 2 key together), followed with the sequence   YYNNYYYNNYY  (these
  822. duplicate the defaults) and then ending it with a control\ (CTRL and \ keys
  823. together.) If you make a mistake, you cannot edit the file, so do the
  824. control\ and start over.
  825.    Case is not significant on the boolean values, and, except for BASEREG
  826. value (an address register number), only 'Y' is actually checked for. When
  827. the assembler runs out of characters or has read enough, it quits the input
  828. read. No error messages are issued for bogus values, so be careful when
  829. creating this file. If you have it available, a better approach would be
  830. to use Newzap on the file distributed with the assembler. If you want to
  831. set different defaults, but don't want a startup file read, make the file-
  832. name NIL:. In all cases the standard defaults can be over-ridden by
  833. command-line switches, which are examined AFTER this file is read.
  834.  
  835.  
  836.                              Page 21
  837.  
  838.  
  839.  
  840.  
  841.  
  842.                               Other notes on use:
  843.  
  844.  
  845.    Case is normally significant on Symbols, Labels and Macro names unless
  846. the -CC switch is used. The Directives, Mnemonics and special symbols will
  847. be recognized in any mixture of UPPER and lower case.
  848.    The only truly reserved symbols are the following:
  849.  
  850.  
  851.                 NARG    MACRO   ENDMAC  ENDM    A0
  852.                 A1      A2      A3      A4      A5
  853.                 A6      A7      D0      D1      D2
  854.                 D3      D4      D5      D6      D7
  855.                 SP      CCR     USP     SR      PC
  856.  
  857.    All the other special Symbols, Mnemonics and Directive names  may be
  858. defined and used as Labels, or may be implemented as Macros, but be careful
  859. when doing this to avoid circular references, which will not be detected
  860. until the Macro nesting level is exceeded, or a write error results from
  861. the disk being full.
  862.    For example, if you redefine JSR as a Macro, and want to use it in the
  863. Macro definition, don't call the assembler with the -CC switch, and be sure
  864. to use a different case within the Macro text to get the assembler to recog-
  865. nize the Mnemonic, which is case-insensitive, from the Macro name.
  866. This allows the maximum flexibility for the assembler, with only a minimum
  867. of care from the programmer.
  868.  
  869.  
  870.                              Page 22
  871.  
  872.  
  873.  
  874.                                Error Messages:
  875.  
  876.    The assembler uses as much logic as possible to generate a line of code
  877. in spite of erroneous input. If a reliable evaluation can be made, a source
  878. line will be interpreted regardless of errors, however some of these lines
  879. may not be what you meant. Even the little bit of DWIM in this assembler
  880. occupies a lot of code space. Because assembly of erroneous lines is
  881. attempted where possible, you may find multiple error messages referring
  882. to the same line. The listing file will only contain the first error
  883. detected, however the screen list or error file will also list the errors
  884. in the order they were detected. Some errors may generate errors later,
  885. especially if typing errors cause the assembler to find an item it thinks
  886. is an undefined symbol in an expression, and you later used this symbol
  887. for another purpose. The following is a list of error messages, and
  888. explanations:
  889.  
  890.          1: Error in Expression Value
  891.                 The expression being evaluated contained some garbage.
  892.          2: Duplicate Line Label
  893.                 An attempt at defining a Label twice was detected. This
  894.                 error does not apply to ENTRY and EXTERN label types.
  895.          3: Undefined Label in Expression
  896.                 The symbol or label used in the expression was not defined
  897.                 anywhere in the source file.
  898.          4: Syntax Error
  899.                 The assembler could make no sense of what you were trying to
  900.                 tell it to do.
  901.          5: Operand Too Large
  902.                 The operand was greater than the value allowed for the
  903.                 operation being performed.
  904.          6: Invalid Register Specified
  905.                 The register called for in the current operation and what
  906.                 was found are not compatable.
  907.          7: Undefined Mnemonic or Command
  908.                 An item in the Mnemonic field is not a defined Macro or
  909.                 valid mnemonic or directive. May also be caused by using
  910.                 a label outside of column one without a colon following it.
  911.          8: Improper use of Unary Operator
  912.                 A Unary operator ('-' or '~') was found right after another
  913.                 math operator. The expression evaluator cannot handle this,
  914.                 so it is ignored and this message is output.
  915.          9: Division by Zero
  916.                 A Division or Modulo operation was attempted where the right
  917.                 hand value was zero or undefined. The result of this
  918.                 operation is set to zero.
  919.  
  920.  
  921.                              Page 23
  922.  
  923.  
  924.  
  925.         10: Too Many Right Parentheses
  926.                 More right parentheses were found than left parentheses.
  927.         11: Missing Right Parenthesis
  928.                 More left parentheses were used than right parentheses.
  929.         12: Too Many Parenthesis Levels
  930.                 More than 16 levels of parentheses were attempted to
  931.                 be opened.
  932.         13: Invalid Character in Expression
  933.                 A character was found in the expression that is not
  934.                 any of the defined mathops, numbers, symbol characters
  935.                 or newline characters.
  936.         14: Closing Quote Absent
  937.                 No closing quote on a character constant was found.
  938.         15: Operand Field Missing
  939.                 An operand was needed, and was not there.
  940.         16: Bit Operand Required
  941.                 The expression needs a bit operand, and what was found was
  942.                 not of the required type.
  943.         17: Invalid Bit Specified
  944.                 The data found cannot be used legally to specify a bit.
  945.         18: Immediate (#) Operand Needed
  946.                 The data given was not preceded by the '#' (pound) sign,
  947.                 and needed to be.
  948.         19: Branch or Jump Out-of-Range
  949.                 The address evaluated is outside of the range allowable for
  950.                 the branch of jump mnemonic specified.
  951.         ** Command Line Required **
  952.                 The message output when no arguments are present on the
  953.                 command-line (you need at least the source filename.)
  954.                 Also a Fatal error.
  955.         ** Unrecognized Switch **
  956.                 A switch or a character within a switch was not one of
  957.                 the valid switches. Not a Fatal error.
  958.         ** File Write Error **
  959.                 An error occurred during a file write, as reported from
  960.                 AmigaDOS. May be caused by a full disk.
  961.         ** Source Filename Missing **
  962.                 The source filename was not present, corrupt or was given
  963.                 twice. A Fatal error.
  964.         ** Parameter Too Long **
  965.                 An Item on the command-line was too long to be evaluated.
  966.                 Also Fatal.
  967.  
  968.  
  969.                              Page 24
  970.  
  971.  
  972.  
  973.  
  974.         ** Insufficient Free Memory **
  975.                 This error occurs when the memory pool does not contain
  976.                 enough memory in a size large enough for the request
  977.                 from the assembler to be filled. Execution stops
  978.                 immediately.
  979.         ** Too many Include Files **
  980.                 This error occurs when you try to open the ninth Include
  981.                 file before closing one.
  982.         ** Couldn't open Source file **
  983.                 AmigaDOS did not return information indicating that the
  984.                 source file was ready to be read from (or it isn't there.)
  985.                 No assembly will take place without a source file.
  986.         ** Couldn't open Object file **
  987.                 A Dos error occurred trying to open the object file.
  988.         ** Couldn't open Listing file **
  989.                 Same error from listing file open attempt.
  990.         ** Couldn't open Error file **
  991.                 Like above, but on error file attempt.
  992.         33: ENDMAC Command missing
  993.                 The end of the source file was reached, and the assembler
  994.                 was still saving a macro definition.
  995.         34: Too Many Parameters present
  996.                 More parameters than the assembler has space to store
  997.                 were found.
  998.         35: Parameter Too Long
  999.                 An item in an expression or an operand was longer than the
  1000.                 defined limit.
  1001.         36: Closing Quote Missing
  1002.                 A string definition should be bounded on both ends with
  1003.                 matching quotes.
  1004.         37: No Label on Line
  1005.                 No label was present for the Directive to act upon.
  1006.         38: Macro called using Symbol label
  1007.                 A symbol name found in the mnemonic field was attempted
  1008.                 to be used as a Macro, and was found to be a Label.
  1009.         ** Too many nested Macros **
  1010.                 This Fatal error occurs when the ninth Macro call is
  1011.                 issued before any of the previous Macro calls have ended.
  1012.         40: Macro redefinition Error
  1013.                 The name used with the MACRO command is already the name
  1014.                 of a previously defined Macro.
  1015.  
  1016.  
  1017.                              Page 25
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.         41: ENDMAC command without MACRO definition
  1024.                 You didn't use the MACRO command to define your Macro, or
  1025.                 you issued the ENDMAC command twice. If you are attempting
  1026.                 to get two or more exit points from a macro, use the
  1027.                 MEXIT Directive.
  1028.         ** INCLUDE file unable to be opened **
  1029.                 This Error occurs when the filename associated with the
  1030.                 INCLUDE command was not found after the include directory
  1031.                 list was exhausted.
  1032.         ** Source or Include file line too long **
  1033.                 An input line read from disk contained more than 255
  1034.                 characters in a row without a carriage return or
  1035.                 linefeed.
  1036.         44: Not enough Macro parameters supplied
  1037.                 An expansion was attempted and there were not enough
  1038.                 parameters on the Macro call line. This may be relaxed
  1039.                 with a command-line switch.
  1040.         45: Label Value changed between passes
  1041.                 This unusual error occurs when the value of a Line Label
  1042.                 is different on the second pass than it was on the first
  1043.                 pass. The whole assembly file is probably corrupt, and
  1044.                 it is likely that the message will repeat with every
  1045.                 subsequent Line Label found. Forward references and
  1046.                 absolute references to SETVAL Labels, or conditional
  1047.                 compilation based on SETVAL Labels are the likely
  1048.                 culprits behind this error.
  1049.         46: Invalid Label - Forward Referenced
  1050.                 A Label which was referenced before it was used was later
  1051.                 found in a context other than usage as a relative location.
  1052.         47: Local Definition of External Symbol not allowed
  1053.                 If you declared a Symbol to be EXTERNal, you cannot define
  1054.                 it within the current assembly. Use the ENTRY Directive
  1055.                 instead if this is what you want.
  1056.         48: Unavailable Addressing Mode Used
  1057.                 The addressing mode used for the Mnemonic on this
  1058.                 line is not one which is allowable for that
  1059.                 Mnemonic.
  1060.         49: Invalid Item in External Reference Expression
  1061.                 An external reference included an item which did not
  1062.                 belong there. This also occurs on an attempt to
  1063.                 generate PC relative references to external addresses.
  1064.         ** Too Many Section Definitions (Limit = 255) **
  1065.                The message is self-explanatory.
  1066.  
  1067.  
  1068.                              Page 26
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.         51: Invalid Section Type - Section CODE used
  1075.                 An item found after the section name was not one of the
  1076.                 valid section types - CODE, TEXT, DATA or BSS; or the mem-
  1077.                 ory specified is not one of the valid types PUBLIC, CHIP
  1078.                 or FAST. The type is set to CODE,PUBLIC.
  1079.         52: Alignment Error - Pad Byte Added
  1080.                 All the 68010 Mnemonics and WORD and LONG oriented Direct-
  1081.                 ives need to be aligned on an even address. The Assembler
  1082.                 attempts to correct this by adding a null byte to the
  1083.                 previous instruction, and adjusts the Program Counter and
  1084.                 Label values accordingly.
  1085.         ** Too Many Conditional Levels Attempted
  1086.                 The seventeenth conditional Directive was found before an
  1087.                 ENDIF Directive was.
  1088.         ** Conditional End without Conditional Statement
  1089.                 There are more ENDIF commands than matching conditional
  1090.                 Directives.
  1091.         55: Relative Reference Outside of Current Section
  1092.                 An attempt to use a PC relative mode to a Line Label that
  1093.                 was not declared as an ENTRY label was attempted. Also
  1094.                 occurs on Data references to other sections without
  1095.                 using the ENTRY type-definition. This message may be
  1096.                 suppressed with a command-line switch.
  1097.         56: Code not allowed in Data & Bss Sections
  1098.                 DATA sections may contain only initialized and uninitialized
  1099.                 data locations, and BSS sections may contain only un-
  1100.                 initialized (RESERVE) data.
  1101.         57: Redefinition of an Equate not Allowed
  1102.                 You cannot change the a Label value that has been EQUATEd.
  1103.         58: Equate to previously SET Label Disallowed
  1104.                 A Label that was set cannot later be upgraded to an equate
  1105.                 in the same assembly. The assembler handles decisions on
  1106.                 equated labels, whose value cannot change, differently
  1107.                 than set labels, whose value may be redefined. Since the
  1108.                 length of 68010 instructions vary with the address mode,
  1109.                 a set label is always treated as a LONG value (unless
  1110.                 otherwise specified) and an equated label is treated
  1111.                 for the value it contains. Since the assembler always
  1112.                 attempts to use the shortest instruction length possible,
  1113.                 a change in the type of a label can cause bad code to be
  1114.                 generated.
  1115.  
  1116.  
  1117.                              Page 27
  1118.  
  1119.  
  1120.  
  1121.                               Addressing Modes:
  1122.  
  1123.    The following models show the valid address modes for the 68010 processor
  1124. as they are recognized by the assembler:
  1125.    ( 'n' represents a digit from 0 to 7, X represents either 'D' or 'A'
  1126.    for an address mode 'ALabel' represents a symbol with an absolute
  1127.    or an external value, 'RLabel' represents a Line Label or an
  1128.    ENTRY typed label, 'number' refers to an actual numerical value, and
  1129.    the other items are what they are. Case is not significant except on
  1130.    Label and Symbol Names. Defined REG Labels of the proper type may be
  1131.    used in place of the register names.)
  1132.  
  1133. IMMEDIATE:                       #number      #ALabel
  1134.  
  1135. DATA REGISTER DIRECT:            Dn
  1136.  
  1137. ADDRESS REGISTER DIRECT:         An       SP
  1138.  
  1139. ADDRESS REGISTER INDIRECT:      (An)     (SP)
  1140.  
  1141. ADDRESS REGISTER INDIRECT WITH POST INCREMENT:           (An)+   (SP)+
  1142.  
  1143. ADDRESS REGISTER INDIRECT WITH PREDECREMENT:            -(An)   -(SP)
  1144.  
  1145. ADDRESS REGISTER INDIRECT WITH DISPLACEMENT:            number(An)
  1146.                                                         number(SP)
  1147.                                                         ALabel(An)
  1148.                                                         ALabel(SP)
  1149.  
  1150. ADDRESS REGISTER INDIRECT WITH DISPLACEMENT AND INDEX:  number(An,Xn)
  1151.                                                         Alabel(An, Xn)
  1152.                                                         number(SP, Xn)
  1153.                                                         ALabel(SP,Xn)
  1154.  
  1155. PROGRAM COUNTER RELATIVE WITH DISPLACEMENT:             RLabel
  1156.                                                         RLabel(PC)
  1157.                                                         number(PC)
  1158.  
  1159. PROGRAM COUNTER RELATIVE WITH DISPLACEMENT AND INDEX:   RLabel(Xn)
  1160.                                                         RLabel(PC, Xn)
  1161.                                                         number(PC, Xn)
  1162.  
  1163. SHORT ABSOLUTE:         ALabel        number
  1164.  
  1165. (where the value is less than $007FFF or greater than $FF8000)
  1166.  
  1167. LONG ABSOLUTE:          RLabel (to another section)
  1168.                         ALabel        number
  1169.  
  1170. (where the value doesn't qualify for short mode)
  1171.  
  1172. SPECIAL:       USP    CCR   SR    VBR    SFC   DFC
  1173.                                
  1174.  
  1175.  
  1176.                              Page 28
  1177.  
  1178.  
  1179.  
  1180.                             16-bit relocatable data
  1181.                             Base Register Addressing
  1182.  
  1183.  
  1184.  
  1185.    Support has been included for Base-Register addressing of data sections
  1186. for use with the "smalldata" option of the BLINK linker. When the BASEREG
  1187. directive is used in the source file with the operand 'BLINK', references
  1188. to external labels using "address register indirect with displacement"
  1189. addressing are output as ext_dref16, which BLINK will adjust so that the
  1190. offset represents the location within the merged data hunk where the
  1191. referenced data is located.
  1192.    If you are using the Lattice startup module, and linking your code with
  1193. BLINK, register A6 is supported for this use. If you are designing your own
  1194. startup module, you need to set the base register you've chosen to the start
  1195. of the data hunk(s).
  1196.    Additionally, the command "BASEREG  [register]" will convert all
  1197. references to external labels, except for immediate addressing mode and the
  1198. JMP and JSR mnemonics, to "address register indirect with displacement"
  1199. using the specified register. Using the command "BASEREG  OFF" will end the
  1200. automatic conversion. This feature has been included to allow easier use of
  1201. this mode, both in new designs and in converting existing programs.
  1202. Compatibility with other assemblers is also enhanced by using this mode,
  1203. since other assemblers which do not support this function may still assemble
  1204. the file if BASEREG is defined as a macro with a null effect (such as
  1205. DS.W 0).
  1206.    Using this mode will save 2 bytes per instruction (or 4 bytes if both the
  1207. source and destination reference external data). Object modules assembled
  1208. with either of these options will not function with the standard Amiga
  1209. linker ALINK; you MUST use BLINK to take advantage of these features. Using
  1210. BASEREG will cause all references to EXTERNal Labels where "address register
  1211. indirect with displacement" mode was used to be output as relative to the
  1212. data module, until the "BASEREG OFF" directive is encountered.
  1213.    If the data section(s) are in the same source file, conversion will not
  1214. be automatic with the BASEREG command, as conversion is triggered by the
  1215. Label's prior definition with the EXTERN (XREF) directive.
  1216.    In order to use PC-Relative data references, such as those used on open
  1217. library calls such as _LVO(An) , use the "BASEREG OFF" command, and reset
  1218. the Base-Register afterwards.
  1219.  
  1220.  
  1221.                              Page 29
  1222.  
  1223.  
  1224.  
  1225.                                Release History:
  1226.  
  1227.  
  1228.    Version 1.0.1 Alpha1.........released 02-Jan-87.
  1229.    Version 1.0.1 Beta1..........released 11-Jan-87.
  1230.    Version 1.0.1 Beta2..........released 20-Jan-87.
  1231.    Version 1.0.1................released 28-Feb-87.
  1232.    Version 1.0.2................released 14-Apr-87.
  1233.    Version 1.0.3................released 24-Apr-87.
  1234.    Version 1.1.0................released 21-Jun-87.
  1235.    Version 1.2.0................released 28-Jun-87.
  1236.    Version 1.2.1 Beta1..........released 03-Jul-87
  1237.                   1)  CMP and CMPI mnemonics with immediate operands less
  1238.                       than 8 once again assemble (broken in 1.2.0)
  1239.                   2)  Forward referenced labels no longer show as un-
  1240.                       referenced on symbol-table dump.
  1241.                   3)  Insidious error on expressions referencing other
  1242.                       sections and using both Line labels and either
  1243.                       EQUated or SET Labels leaving relocation information
  1244.                       referencing the wrong hunk has been corrected.
  1245.                   4)  Problems stopping the program on disk write errors,
  1246.                       particularly disk full have been eliminated.
  1247.                   5)  ENTRY Labels declared but undefined no longer are
  1248.                       made visible to the linker (they formerly appeared
  1249.                       referencing the base of the first hunk.)
  1250.    Version 1.2.1 Beta1..........released 13-Aug-87
  1251.                   1)  Symbols containing periods are now handled correctly
  1252.                       within mnemonic expressions.
  1253.  
  1254.    A special note of gratitude to various members of ASDF (Amiga Software
  1255. Developers Forum), The Software Distillery (whose BLink reduced the many
  1256. hours spent relinking the source files during development), and
  1257. especially John Toebes, whose offhand remarks unknowingly provided much of
  1258. the inspiration to keep going. Also DJ JAMES, KEN S and cheath for their
  1259. work in running down some of the problems I missed.
  1260.  
  1261.  
  1262. NOTE:   Amiga and AmigaDOS are trademarks of Commodore Business Machines.
  1263.         Intel is a trademark of the Intel Co.
  1264.         MC68000 and MC68010 are trademarks of Motorola Co.
  1265.  
  1266.  
  1267.                                 THE END
  1268.  
  1269.